﻿using System;

namespace TypeBuilderFx.Core
{
    /// <summary>Represents a factory of dynamic types.</summary>
    /// <typeparam name="T">Type it creates.</typeparam>
    public interface IFactory<T>
        where T : class
    {
        /// <summary>Returns a new instance.</summary>
        /// <returns></returns>
        T Build();
    }

    /// <summary>Represents a factory of dynamic types.</summary>
    /// <typeparam name="T">Type it creates.</typeparam>
    /// <typeparam name="P">Type of the parameter used in the instance creation (constructor parameter).</typeparam>
    public interface IFactory<T, P>
        where T : class
    {
        /// <summary>Returns a new instance.</summary>
        /// <param name="constructorParameter"></param>
        /// <returns></returns>
        T Build(P constructorParameter);
    }

    /// <summary>Represents a factory of dynamic types.</summary>
    /// <typeparam name="T">Type it creates.</typeparam>
    /// <typeparam name="P1">Type of the first parameter used in the instance creation (constructor parameter).</typeparam>
    /// <typeparam name="P2">Type of the second parameter used in the instance creation (constructor parameter).</typeparam>
    public interface IFactory<T, P1, P2>
        where T : class
    {
        /// <summary>Returns a new instance.</summary>
        /// <param name="constructorParameter1"></param>
        /// <param name="constructorParameter2"></param>
        /// <returns></returns>
        T Build(P1 constructorParameter1, P2 constructorParameter2);
    }
}